<template>
	<view class="count-down-wrap">
		<u-count-down :time="time" format="HH:mm:ss" autoStart millisecond @change="onChange">
			<view class="time flex">
				<view class="time__custom">
					<text class="time__custom__item">{{ timeData.hours>=10?timeData.hours:'0'+timeData.hours}}</text>
				</view>
				<text class="time__doc">:</text>
				<view class="time__custom">
					<text class="time__custom__item">{{ timeData.minutes>=10?timeData.minutes:'0'+timeData.minutes }}</text>
				</view>
				<text class="time__doc">:</text>
				<view class="time__custom">
					<text class="time__custom__item">{{ timeData.seconds>=10?timeData.seconds:'0'+timeData.seconds }}</text>
				</view>
			</view>
		</u-count-down>
	</view>
</template>
<script>
	export default {
		props: {
			time: {
				type: [String, Number],
				default: 0
			}
		},
		data() {
			return {
				timeData: {},
			}
		},
		methods: {
			onChange(e) {
				this.timeData = e
			}
		}
	}
</script>

<style lang="scss" scoped>
	.time {
		align-items: center;

		&__custom {
			width: 40rpx;
			height: 32rpx;
			background-color: #FFFFFF;
			border-radius: 4px;
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			justify-content: center;
			align-items: center;

			&__item {
				color: #CB0011;
				font-size: 12px;
				text-align: center;
			}
		}

		&__doc {
			color: #FFFFFF;
			padding: 0px 4px;
		}

		&__item {
			color: #CB0011;
			font-size: 15px;
			margin-right: 4px;
		}
	}
</style>